﻿using System;
using System.Runtime.Serialization;
using Battle.Net.Infrastructure;

namespace Battle.Net.Model
{
    [DataContract]
    public class Character
    {
        [DataMember(Name = "achievementPoints")]
        public int AchievementPoints { get; set; }
        [DataMember(Name = "battlegroup")]
        public string Battlegroup { get; set; }
        [DataMember(Name = "calcClass")]
        public string CalcClass { get; set; }
        [DataMember(Name = "class")]
        public CharacterClass Class { get; set; }
        [DataMember(Name = "gender")]
        public CharacterGender Gender { get; set; }

        public DateTime LastModified { get; set; }
        [DataMember(Name = "level")]
        public int Level { get; set; }
        [DataMember(Name = "name")]
        public string Name { get; set; }
        [DataMember(Name = "race")]
        public CharacterRace Race { get; set; }
        [DataMember(Name = "realm")]
        public string Realm { get; set; }
        [DataMember(Name = "thumbnail")]
        public string Thumbnail { get; set; }

        [DataMember(Name = "rank")]
        public int GuildRank { get; set; }

        [DataMember(Name = "spec")]
        public CharacterSpec Spec { get; set; }

        [DataMember(Name = "guild")]
        public CharacterGuild _CharacterGuild { get; set; }

        [DataMember(Name = "items")]
        public CharacterItems Items { get; set; }

        [DataMember(Name = "progression")]
        public CharacterProgression Progression { get; set; }

        [DataMember(Name = "lastModified")]
        internal string LastModifiedInternal
        {
            set { LastModified = value.FromUnixTimestamp(); }
            get { return LastModified.Ticks.ToString(); }
        }

    }
}
